package bolangit.test.dao;

import bolangit.test.model.RentCarRecord;
import bolangit.test.model.RentCarRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RentCarRecordMapper {
    @SelectProvider(type=RentCarRecordSqlProvider.class, method="countByExample")
    long countByExample(RentCarRecordExample example);

    @DeleteProvider(type=RentCarRecordSqlProvider.class, method="deleteByExample")
    int deleteByExample(RentCarRecordExample example);

    @Delete({
        "delete from rent_car_record",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into rent_car_record (id, start_time, ",
        "start_local, card_num, ",
        "end_time, end_local, ",
        "record_start_time, create_user)",
        "values (#{id,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, ",
        "#{startLocal,jdbcType=VARCHAR}, #{cardNum,jdbcType=VARCHAR}, ",
        "#{endTime,jdbcType=TIMESTAMP}, #{endLocal,jdbcType=VARCHAR}, ",
        "#{recordStartTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=VARCHAR})"
    })
    int insert(RentCarRecord record);

    @InsertProvider(type=RentCarRecordSqlProvider.class, method="insertSelective")
    int insertSelective(RentCarRecord record);

    @SelectProvider(type=RentCarRecordSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="start_local", property="startLocal", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_num", property="cardNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_local", property="endLocal", jdbcType=JdbcType.VARCHAR),
        @Result(column="record_start_time", property="recordStartTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_user", property="createUser", jdbcType=JdbcType.VARCHAR)
    })
    List<RentCarRecord> selectByExample(RentCarRecordExample example);

    @Select({
        "select",
        "id, start_time, start_local, card_num, end_time, end_local, record_start_time, ",
        "create_user",
        "from rent_car_record",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="start_local", property="startLocal", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_num", property="cardNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_local", property="endLocal", jdbcType=JdbcType.VARCHAR),
        @Result(column="record_start_time", property="recordStartTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_user", property="createUser", jdbcType=JdbcType.VARCHAR)
    })
    RentCarRecord selectByPrimaryKey(String id);

    @UpdateProvider(type=RentCarRecordSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") RentCarRecord record, @Param("example") RentCarRecordExample example);

    @UpdateProvider(type=RentCarRecordSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") RentCarRecord record, @Param("example") RentCarRecordExample example);

    @UpdateProvider(type=RentCarRecordSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(RentCarRecord record);

    @Update({
        "update rent_car_record",
        "set start_time = #{startTime,jdbcType=TIMESTAMP},",
          "start_local = #{startLocal,jdbcType=VARCHAR},",
          "card_num = #{cardNum,jdbcType=VARCHAR},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "end_local = #{endLocal,jdbcType=VARCHAR},",
          "record_start_time = #{recordStartTime,jdbcType=TIMESTAMP},",
          "create_user = #{createUser,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(RentCarRecord record);
}